<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>

	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<ui:define name="title">#{commonBundle.title}</ui:define>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">
				<ui:define name="content">
					<ui:decorate template="/facelets/template/simpleTableTemplate.xhtml">
						<ui:param name="showAddLink" value="#{studentBean.showMainLink}"/>
						<ui:param name="actionBean" value="#{studentBean}"/>
						<ui:param name="idPrefix" value="studentTable"/>
						<ui:param name="colNum" value="9"/>
						<ui:define name="beforeTable">
						</ui:define>
						<ui:define name="selected">
							<a4j:commandLink value="#{commonBundle.expell}" action="#{studentBean.requestExpell}"
											 rendered="#{studentBean.showMainLink}"/>
							<rich:spacer width="10"/>
							<a4j:commandLink value="#{commonBundle.diploma}"
											 action="#{studentBean.requestObtainDiploma}"
											 rendered="#{studentBean.showMainLink}"/>
							<rich:spacer width="10"/>

							<div align="right">
								<a4j:commandLink value="#{commonBundle.deleteSelected}"
												 action="#{studentBean.massDelete}"
												 rendered="#{studentBean.showMasDeleteLink}"/>
								<br/>
								<a4j:commandLink value="#{commonBundle.accept}"
												 action="#{studentBean.acceptStudentEvent}"
												 rendered="#{studentBean.showAcceDenyLink}"/>
								<br/>
								<a4j:commandLink value="#{commonBundle.deny}" action="#{studentBean.denyStudentEvent}"
												 rendered="#{studentBean.showAcceDenyLink}"/>
							</div>
							<br/>
							<h:outputText value="#{commonBundle.select} "/>
							<a4j:commandLink value="#{commonBundle.selectAll} / " action="#{studentBean.selectedAll}"/>
							<a4j:commandLink value="#{commonBundle.selectNone}" action="#{studentBean.selectedNone}"/>
						</ui:define>
						<ui:define name="tableContext">
							<h:column>
								<f:facet name="header">
									<h:outputText value="Select"/>
								</f:facet>
								<h:selectBooleanCheckbox value="#{studentBean.selectedIds[record.id]}"/>
							</h:column>
							<rich:column id="colStudFlag">
								<f:facet name="header">
									<h:graphicImage url="/img/all.PNG" styleClass="graphicImage"/>
								</f:facet>
								<rich:dataTable id="studentFlagTable" style="border-left:0; border-top:0; cell=border-bottom:0"
												styleClass="gridFlagTable"
												border="0"
												onRowMouseOver="this.style.backgroundColor='#f1f1f1';"
												onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}';"
												var="rec" value="#{record.studentFlags}"
												binding="#{studentFlagBean.tableBinding}">
									<rich:column>

										<a4j:mediaOutput id="pic" element="img"
														 styleClass="graphicImage noBorder"
														 value="#{rec.flag.userMark}"
														 createContent="#{flagBean.paint}"/>
										<rich:toolTip for="pic" value="#{rec.commentUserMark}"/>
										<rich:contextMenu event="oncontextmenu" attachTo="pic" submitMode="none">
											<rich:menuItem value="#{commonBundle.delete}">
												<a4j:support event="onselect" reRender="colStudFlag"
															 action="#{studentFlagBean.delete}">
												</a4j:support>
											</rich:menuItem>
										</rich:contextMenu>
									</rich:column>
								</rich:dataTable>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{studentBundle.educationType}"/>
								</f:facet>

								<div align="left">
									<h:graphicImage url="/img/smallPaid.PNG"
													rendered="#{not empty  record.educationType}"
													styleClass="graphicImage"/>
								</div>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{studentBundle.educationStatus}"/>
								</f:facet>

								<div align="left">
									<h:graphicImage url="/img/smallStar.PNG"
													rendered="#{not empty  record.studentPosition}"
													styleClass="graphicImage"/>
								</div>
							</rich:column>
							<rich:column colspan="0">
								<f:facet name="header">
									<h:outputText value="#{commonBundle.photo}"/>
								</f:facet>

								<div class="graphicImageInList">
									<h:graphicImage url="/img/Nibbler.png" styleClass="graphicImage"
													rendered="#{empty record.personPhoto}"/>
									<a4j:mediaOutput element="img" styleClass="graphicImage noBorder"
													 rendered="#{not empty record.personPhoto}"
													 value="#{record.personPhoto.photo}"
													 createContent="#{personPhotoBean.paint}"/>
								</div>
							</rich:column>
							<rich:column sortBy="#{studentBean.sortProperty}" sortOrder="#{studentBean.ordering}">
								<f:facet name="header">
									<h:outputText value="#{personBundle.lastNameMiddleNameFirstName}"/>
								</f:facet>
								<h:panelGroup>
									<div align="left">
										<h:outputText
												value="#{record.lastName} #{record.firstName} #{record.middleName}"
												styleClass="requiredField"/>
									</div>
								</h:panelGroup>
							</rich:column>
							<rich:column sortBy="#{studentBean.sortStudentGroup}">
								<f:facet name="header">
									<h:outputText value="#{departmentBundle.studentGroup}"/>
								</f:facet>

								<div align="left">
									<itdep:entityOutput value="#{record.studentGroup}" format="{i18n.description}"
														locale="#{translationBean.locale}"
														styleClass="requiredField"/>
								</div>
							</rich:column>
							<rich:column sortBy="#{studentBean.sortBookNumber}">
								<f:facet name="header">
									<h:outputText value="#{studentBundle.bookNumber}"/>
								</f:facet>

								<div align="left">
									<h:outputText value="#{record.bookNumber}" styleClass="requiredField"/>
								</div>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{commonBundle.action}"/>
								</f:facet>
								<h:commandLink value="#{commonBundle.restore}" action="#{studentBean.requestRestore}"
											   rendered="#{studentBean.showRestore}"/>
								<br/>
								<a4j:commandLink value="#{commonBundle.details}" action="#{studentBean.showDetails}"
												 reRender="content" immediate="true"/>
								<br/>
								<a4j:commandLink value="#{commonBundle.setMark}"
												 action="#{studentBean.markStudentFlag}"
												 reRender="content" immediate="true"/>
								<br/>
								<a4j:commandLink value="#{commonBundle.delete}" action="#{studentBean.delete}"
												 rendered="#{!studentBean.showMasDeleteLink}"
												 reRender="content" immediate="true"/>
							</rich:column>
						</ui:define>
					</ui:decorate>
				</ui:define>
				<ui:define name="search">
					<a4j:form id="#{idPrefix}searchForm">
						<a4j:queue requestDelay="50"/>
						<h:panelGrid>
							<h:outputText value="#{personBundle.lastName}"/>

							<h:inputText value="#{studentBean.filter.lastName}"
										 maxlength="100">
								<a4j:support event="onkeyup" reRender="studentTableTablePanel"/>
							</h:inputText>
							<ui:decorate template="/facelets/template/student/suggestionBox.xhtml">
								<ui:param name="idPrefix" value="studentTable"/>
								<ui:param name="actionBean" value="#{studentFlagBean}"/>
								<ui:define name="action">
									<a4j:support event="onselect" reRender="#{idPrefix}TablePanel"
												 action="#{studentBean.filterStudent}">
										<f:setPropertyActionListener value="#{result}"
																	 target="#{studentFlagBean.filter.flag}"/>
									</a4j:support>
								</ui:define>
							</ui:decorate>
						</h:panelGrid>
					</a4j:form>

				</ui:define>

			</ui:decorate>
		</ui:define>
	</ui:decorate>
</f:view>